<!DOCTYPE html>
<html>
<head>
    <meta name="robots" content="noindex, nofollow"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
    <title>{$Think.config.APP_NAME}</title>
    <!-- 引入bootstrap样式 -->
    <link href="__PUBLIC__/bootstrap/css/bootstrap.min.css" rel="stylesheet" media="screen">
    <link href="__PUBLIC__/bootstrap/css/bootstrap-responsive.css" rel="stylesheet" media="screen">
    <!--[if lte IE 7]>
    <link rel="stylesheet" type="text/css" href="__PUBLIC__/bootstrap/css/ie.css">
    <![endif]-->
    <!-- 引入EasyUI样式 -->
    <link id="easyuiTheme" rel="stylesheet" href="__PUBLIC__/easyui/themes/default/easyui.css" type="text/css">

    <!-- 引入jQuery -->
    <script src="__PUBLIC__/js/jquery.min.js" type="text/javascript" charset="utf-8"></script>

    <!-- 引入EasyUI -->
    <script type="text/javascript" src="__PUBLIC__/easyui/jquery.easyui.min.js" charset="utf-8"></script>
    <script type="text/javascript" src="__PUBLIC__/easyui/easyui.ext.js" charset="utf-8"></script>
    <script type="text/javascript" src="__PUBLIC__/easyui/locale/easyui-lang-zh_CN.js" charset="utf-8"></script>

</head>
<body>
<div class="easyui-layout" data-options="fit : true,border : false">
    <div data-options="region:'north',border:false" style="height: 65px; overflow: hidden;">
        <form id="searchForm">
            <block name="search">
                <table class="search-table table-condensed">
                    <tr>
                        <td>关键字</td>
                        <td><input type="text" name="keyword" class="span2 input-text"></td>
                        <td><a href="javascript:void(0);" id="btn_search" class="easyui-linkbutton"
                               data-options="plain:true,iconCls:'icon-search'">搜索</a>
                            <a href="javascript:void(0);" id="btn_clear" class="easyui-linkbutton"
                               data-options="plain:true,iconCls:'icon-remove'">清空</a>
                        </td>
                    </tr>
                </table>
            </block>
        </form>
    </div>
    <div id="toolbar">
        <block name="toolbar">
        </block>
    </div>
    <div data-options="region:'center',border:false">
        <table id="dataGrid">
            <block name="columns">
                <thead data-options="frozen:true">
                <tr>
                    <th data-options="checkbox:true"></th>
                    <th data-options="field:'id',width:120,formatter:format_operation">操作</th>
                </tr>
                </thead>
                <thead>
                <tr>
                    <th data-options="field:'title',width:150">标题</th>
                </tr>
                </thead>
            </block>
        </table>
    </div>
</div>
</body>
</html>

<!--引入数组字典的格式化函数列表-->
<script type="text/javascript" src="/app/Sys/Dict/js" charset="utf-8"></script>
<script src="__PUBLIC__/js/app.js" type="text/javascript" charset="utf-8"></script>
<script src="__PUBLIC__/js/curd.js" type="text/javascript" charset="utf-8"></script>
<script src="__PUBLIC__/js/common.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
    curd.api = '{$Think.const.MODULE_NAME}/{$Think.const.CONTROLLER_NAME}/';
    curd.addUrl = '__URL__/add';
    curd.editUrl = '__URL__/edit/id/';
    var gridOption = {
        title: '',
        url:  app.api + curd.api + 'lists',
        method: 'get',
        idField: 'id', //主键
        sortName: 'id',
        sortOrder: 'DESC',
        checkOnSelect: false,
        selectOnCheck: true,
        singleSelect: false,
        pagination: true,
        height: $(window).height() - 65,
        pageList: [20, 50, 100, 500, 1000],
        pageSize: 20,
        toolbar: '#toolbar',
        onLoadSuccess: function () {
            $('.iconImg').attr('src', "__PUBLIC__/images/common/pixel_0.gif");//解决class="iconImg"的img标记，没有src的时候，会出现边框问题
            curd.clean();
        }
    };
</script>

<block name="script">
    <script>
        function format_operation(value, row, index) {
            return 'o:' + row.id;
        }
    </script>
</block>
<script>
    $(function () {
        curd.dataGrid = $('#dataGrid').datagrid(gridOption);

        $('#btn_search').click(function () {
            curd.search();
        });

        $("#btn_clear").on('click', function () {
            $('#searchForm').form('clear');
        });
    });
</script>